package com.jnu.keepaccounts;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class SelectPopWindow extends Activity implements View.OnClickListener {
    int resultcode;
    protected void onCreate(Bundle saveInstanceState){
        super.onCreate(saveInstanceState);
        setContentView(R.layout.poplayout);

        LinearLayout linearLayout_xianjin = findViewById(R.id.xianjin);
        LinearLayout linearLayout_weixin  = findViewById(R.id.weixin);
        LinearLayout linearLayout_zhifubao = findViewById(R.id.zhifubao);

        resultcode = getIntent().getIntExtra("requestcode",0);

        LinearLayout linearLayout_select = findViewById(R.id.pop_layout);

        linearLayout_select.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        linearLayout_xianjin.setOnClickListener(this);
        linearLayout_weixin.setOnClickListener(this);
        linearLayout_zhifubao.setOnClickListener(this);

    }
    public boolean onTouchEvent(MotionEvent event){
        finish();
        return true;
    }

    @Override
    public void onClick(View v) {
        Intent intent;
        switch(v.getId()){
            case R.id.xianjin:
                intent = new Intent();
                intent.putExtra("resultcode",resultcode);
                intent.putExtra("selection","现金");
                setResult(1,intent);
                finish();
                break;
            case R.id.weixin:
                intent = new Intent();
                intent.putExtra("resultcode",resultcode);
                intent.putExtra("selection","微信");
                setResult(1,intent);
                finish();
                break;
            case R.id.zhifubao:
                intent = new Intent();
                intent.putExtra("resultcode",resultcode);
                intent.putExtra("selection","支付宝");
                setResult(1,intent);
                finish();
                break;
            default:break;
        }
    }
}
